﻿using System;
using System.Linq;
using System.Web;
using System.Web.SessionState;
using WF.BusinessObject;

namespace WF.Web.Pages
{
    /// <summary>
    /// DeptLimited 的摘要说明
    /// </summary>
    public class HandlerDeptLimit : HrBasePage, IHttpHandler, IRequiresSessionState
    {
        public override void ProcessRequest(HttpContext context)
        {
            if (base.Valid)
            {
                string dept = string.Empty;
                var deptName = context.Request["deptName"].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                SecurityManager sm = new SecurityManager();
                var deptArr = (from a in sm.GetAllUnit(deptName) select a.Path).ToArray();
                foreach (var str in deptArr)
                    dept += str + ";";
                new ConfigHelper().DepartmentLimite = dept;
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}